<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>学生管理</title>
</head>

<link rel="shortcut icon" href="../../static/favicon.ico" th:href="@{/static/favicon.ico}">
<link href="../../static/css/bootstrap.min.css?v=3.3.6" th:href="@{/static/css/bootstrap.min.css}" rel="stylesheet">
<link href="../../static/css/font-awesome.css?v=4.4.0" th:href="@{/static/css/font-awesome.css}" rel="stylesheet">
<link href="../../static/css/plugins/bootstrap-table/bootstrap-table.min.css"
      th:href="@{/static/css/plugins/bootstrap-table/bootstrap-table.min.css}" rel="stylesheet">
<link href="../../static/css/animate.css" th:href="@{/static/css/animate.css}" rel="stylesheet">
<link href="../../static/css/style.css?v=4.1.0" th:href="@{/static/css/style.css}" rel="stylesheet">
<!-- Sweet Alert -->
<link href="../../static/css/plugins/sweetalert/sweetalert.css"
      th:href="@{/static/css/plugins/sweetalert/sweetalert.css}" rel="stylesheet">
<!--simditor-->
<link rel="stylesheet" type="text/css" href="../../static/css/plugins/simditor/simditor.css"
      th:href="@{/static/css/plugins/simditor/simditor.css}"/>
<style type="text/css">
    /*.col-md-2.text-center:hover {
        box-shadow: 10px 10px 5px #888888;
    }*/
    li {
        list-style: none;
    }

    #box a {
        text-decoration: none;
    }

    #box li {
        width: 163px;
        height: 65px;
        float: left;
        background: url(../../static/public/teaching/img/btn.png) no-repeat;
        position: relative;
    }

    #box img {
        position: absolute;
        left: 50%;
        bottom: 8px;
        z-index: 3;
        width: 0;
        margin-left: 0;
    }

    #box li a {
        width: 152px;
        height: 44px;
        padding-top: 8px;
        text-align: center;
        font-size: 14px;
        font-weight: bold;
        font-family: arial;
        color: #fff;
        line-height: 18px;
        position: absolute;
        top: 4px;
        left: 4px;
        z-index: 2;
    }

    #box li a span {
        color: #999;
        font-weight: normal;
        font-size: 12px;
    }

    #box .bg {
        width: 152px;
        height: 0;
        background: #2f4050;;
        position: absolute;
        left: 4px;
        top: 56px;
        z-index: 1;
        overflow: hidden;
    }

    .input_margin {
        margin-left: 20px;
    }

    .table > thead > tr > th {
        color: #2a62bc;
    }

    /*问题详情*/
    .ask-details-con {
        padding: 15px;
        border: 1px solid #e4e4e4;
        margin-top: 15px;
        background-color: #FFFFFF;
        height: 131px;
    }

    .form-inline .input-group > .form-control {
        width: auto;
    }

    .fa.fa-download {
        margin-top: 10px;
    }

    .simditor .simditor-body {
        /*设置高度*/
        min-height: 120px;
    }

    /*表格内容居中*/
    .table th, .table td {
        text-align: center;
        vertical-align: middle !important;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox-title">
        <div class="row row-lg">
            <div class="col-sm-12">
                <div class="tab-pane">
                    <div class="panel-body">
                        <form class="form-inline">
                            <div class="form-group">
                                <h3 id="className"></h3>
                            </div>
                            <div class="ibox-tools">
                                <a href="/owep/teaching/teaching.html" class="btn btn-success " style="color: #FFFFFF" id="back">返回</a>
                            </div>
                            <hr style="margin-top: 4px;">
                        </form>
                    </div>
                </div>
                <div class="tabs-container">
                    <ul class="nav nav-tabs">
                        <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true" id="message">基本信息</a>
                        </li>
                        <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false"
                                        id="class_resource">班级资源</a></li>
                        <li class=""><a data-toggle="tab" href="#tab-3" aria-expanded="false"
                                        id="class_question">班级问题</a></li>
                        <li class=""><a data-toggle="tab" href="#tab-4" aria-expanded="false" id="homework_correcting">批改作业</a>
                        </li>
                        <li class=""><a data-toggle="tab" href="#tab-5" aria-expanded="false" id="student_evaluation">学生评价</a>
                        </li>
                        <li class=""><a data-toggle="tab" href="#tab-6" aria-expanded="false"
                                        id="ask_for_leave">请假处理</a></li>
                        <li class=""><a data-toggle="tab" href="#tab-7" aria-expanded="false" id="disciplinary_process">违纪处理</a>
                        </li>
                    </ul>
                    <div class="tab-content">
                        <div id="tab-1" class="tab-pane active">
                            <div class="panel-body">
                                <h4 class="heading lead" style="margin-top: 20px">
                                    班级介绍
                                    <div style="background-color:#1a7bb9;height: 4px;width: 90px"></div>
                                    <hr style="margin-top: 0;margin-bottom: 20px">
                                    <div class="ibox">
                                        <h5 class="lead">
                                            JavaEE企业级开发
                                        </h5>
                                    </div>
                                </h4>
                                <h4 class="heading lead" style="margin-top: 100px">
                                    班级课程
                                    <div style="background-color:#1a7bb9;height: 4px;width: 90px"></div>
                                    <hr style="margin-top: 0;margin-bottom: 20px">
                                    <div class="col-md-2 text-center" id="box"
                                         onclick="javascript:location.href='courseDetails.html'"
                                         style="cursor:pointer;">
                                        <ul>
                                            <li style="margin-top: 40px;border-bottom-width: 0;border-bottom-style: solid;margin-bottom:100px;">
                                                <img src="../../static/public/teaching/img/getImage_002.png"
                                                     alt="Java核心技术(一)"/>
                                                <a href="#">JavaScript<br/><span>Java核心技术(一)</span></a>
                                                <span class="bg"></span>
                                            </li>
                                        </ul>
                                    </div>
                                </h4>
                            </div>
                        </div>
                        <!--========================班级资源========================================-->
                        <div id="tab-2" class="tab-pane">
                            <div class="panel-body">
                                <h4 class="heading lead" style="margin-top: 20px">
                                    班级资源
                                    <div style="background-color:#1a7bb9;height: 4px;width: 90px"></div>
                                    <hr style="margin-top: 0;margin-bottom: 20px">
                                </h4>
                                <form class="form-inline" style="margin: 20px 0 20px 0">
                                    <div class="form-group">
                                        <label style="font-size: 16px" class="lead">资源名称:</label>
                                        <input type="text" name="resourceName" class="form-control"
                                               style="border-radius: 5px;"
                                               id="exampleInputUserName2">
                                    </div>
                                    <button type="button" class="btn btn-success input_margin"
                                            style="padding-bottom: 7px;margin-bottom: 13px;" id="selectResource">查询
                                    </button>
                                    <div class="ibox-tools">
                                        <button type="button" class="btn btn-danger delete_list">删除</button>
                                    </div>
                                </form>
                                <table id="tb_departments_2"></table>
                            </div>
                        </div>
                        <!--==============================班级问题===========================================-->
                        <div id="tab-3" class="tab-pane">
                            <div class="panel-body">
                                <h4 class="heading lead" style="margin-top: 20px">
                                    班级问答
                                    <div style="background-color:#1a7bb9 ;height: 4px;width: 90px"></div>
                                    <hr style="margin-top: 0;margin-bottom: 20px">
                                </h4>
                                <table id="tb_departments_3"></table>
                            </div>
                        </div>
                        <!--============================================批改作业===========================================-->
                        <div id="tab-4" class="tab-pane">
                            <div class="panel-body">
                                <table id="tb_departments_4"></table>
                            </div>
                        </div>
                        <!--===========================================学生评价====================================================-->
                        <div id="tab-5" class="tab-pane">
                            <div class="panel-body">
                                <table id="tb_departments_5"></table>
                            </div>
                        </div>
                        <!--==============================================请假处理==============================================-->
                        <div id="tab-6" class="tab-pane">
                            <div class="panel-body">
                                <table id="tb_departments_6"></table>
                            </div>
                        </div>
                        <!--==============================================违纪处理===========================================-->
                        <div id="tab-7" class="tab-pane">
                            <div class="ibox-content" style="padding-left: 0;">
                                <form class="form-inline" style="margin:15px 5px;">
                                    <div class="pull-left" style="margin-bottom: 50px">
                                        <div class="form-group">
                                            <label>学号:</label>
                                            <div class="input-group">
                                                <input type="text" class="form-control" style="border-radius: 5px;"
                                                       id="class_num" name="classNum">
                                            </div>
                                        </div>
                                        <div class="form-group input_margin">
                                            <label>姓名:</label>
                                            <div class="input-group">
                                                <input type="text" class="form-control" id="major_name"
                                                       style="border-radius: 5px;" name="stuName">
                                            </div>
                                        </div>
                                        <div class="form-group input_margin">
                                            <label>开始时间:</label>
                                            <div class="input-group">
                                                <input class="form-control layer-date" id="start"
                                                       style="border-radius: 5px;" name="startTime">
                                            </div>
                                        </div>
                                        <div class="form-group input_margin">
                                            <label>结束时间:</label>
                                            <div class="input-group">
                                                <input class="form-control layer-date" id="end"
                                                       style="border-radius: 5px;" name="endTime">
                                            </div>
                                        </div>
                                        <input type="button" class="btn btn-success input_margin"
                                               style="display: inline ;margin-top: 3px; border-radius: 5px;"
                                               value="查询"
                                               id="selectIllegal"/>
                                    </div>
                                    <div class="pull-right">
                                        <div class="form-group">
                                            <input type="button" class="btn btn-success"
                                                   style="display: inline ;margin-top: 3px; border-radius: 5px;"
                                                   value="添加" data-toggle="modal" data-target="#add"
                                                   id="addBtn"/>
                                        </div>
                                    </div>
                                </form>
                                <table id="tb_departments_7"></table>
                            </div>
                        </div>
                    </div>
                </div>
                <!--添加违纪记录============================模态框============================-->
                <div class="modal fade" id="add" tabindex="-1">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <span class="close" data-dismiss="modal">&times;</span>
                                <h3 class="modal-title">添加违约记录</h3>
                            </div>

                            <div class="modal-body" style="min-height: 300px;margin-top: 20px">
                                <form action="#" class="form-horizontal" method="post" name="addIllegalForm">
                                    <input type="hidden" id="studentId" name="studentId">
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label right">违规学生：</label>
                                        <div class="col-sm-7">
                                            <div class="input-group">
                                                <input type="text" class="form-control org" name="studentName" id="IllegalId">
                                                <div class="input-group-btn" style="z-index:99999!important;">
                                                    <button type="button" class="btn btn-white dropdown-toggle"
                                                            data-toggle="dropdown">
                                                        <span class="caret"></span>
                                                    </button>
                                                    <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                                    </ul>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label right ">违规时间：</label>
                                        <div class="col-sm-7">
                                            <input type="text" class="form-control" id="bad_time" name="disciplineTime">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label right">附件说明：</label>
                                        <div class="col-sm-7">
                                            <div id="file-pretty">
                                                <input type="file" multiple="multiple" class="form-control"
                                                       name="file">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label right">说明情况：</label>
                                        <div class="col-sm-7">
                                            <textarea class="form-control" type="text" name="presentationCondition" id="illustrate"></textarea>
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="modal-footer">
                                <button class="btn btn-success" data-dismiss="modal">关闭</button>
                                <button class="btn btn-success" id="add_sure">确定</button>
                            </div>
                        </div>
                    </div>
                </div>
                <!--=========================班级问题模态框===========================-->
                <div class="modal fade" id="qa" tabindex="-1">
                    <input type="hidden" id="question_id">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <span class="close" data-dismiss="modal">&times;</span>
                                <h3 class="modal-title">解答</h3>
                            </div>
                            <form class="form-horizontal" id="question_box">
                                <div class="modal-body">
                                    <div class="chat-activity-list">
                                        <div class="chat-element">
                                            <a href="#" class="pull-left">
                                                <img alt="image" class="img-circle" src="../../static/img/a2.jpg">
                                            </a>
                                            <div class="media-body">
<!--                                                <input type="hidden" id="studentQuestionName">-->
                                                <strong class="student">李小冉</strong>
                                                <p class="m-b-xs">
                                                    循环有点不太明白
                                                </p>
                                                <small class="text-muted">2020-06-12 00:00:00</small>
                                            </div>
                                        </div>
                                        <div class="chat-element right" id="reply_box">
                                            <a href="#" class="pull-right">
                                                <img alt="image" class="img-circle" src="../../static/img/a4.jpg">
                                            </a>
                                            <div class="media-body text-right ">
                                                <strong class="admin">admin </strong>
                                                <p class="m-b-xs" id="">
                                                    <!--                                                    多看视频-->
                                                </p>
                                                <small class="text-muted">2020-06-12 15:04:23</small>
                                            </div>
                                        </div>
                                    </div>
                                    <h2 style="margin-top: 20px;"><strong>我要回答</strong></h2>
                                    <textarea id="editor" autofocus></textarea>
                                </div>
                            </form>

                            <div class="modal-footer">
                                <button class="btn btn-success" data-dismiss="modal">关闭</button>
                                <button class="btn btn-success">确定</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--模态框-->
<!--=======================================================批改作业模态框-->
<div class="modal fade" id="checkwork" tabindex="-1">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <span class="close" data-dismiss="modal">&times;</span>
                <h3 class="modal-title">批改作业</h3>
            </div>

            <div class="modal-body" style="min-height: 400px;margin-top: 20px">
                <form action="#" class="form-horizontal" method="post">
                    <input type="hidden" id="approvalId">
                    <div class="form-group">
                        <label class="col-sm-3 control-label right ">作业标题：</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" placeholder="" id="work_title"
                                   disabled>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label right ">作业内容：</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" placeholder=""
                                   id="work_content" disabled>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label right ">布置时间：</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" placeholder="" id="start_time"
                                   disabled>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label right ">作业附件：</label>
                        <div class="col-sm-7">
                            <a href="../../static/img/a1.jpg" download="文件下载"><i
                                    class="fa fa-download"></i></a>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label right ">学生姓名：</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" placeholder="" id="stu_name"
                                   disabled>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label right ">写作时间：</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" placeholder=""
                                   id="work_time"
                                   disabled>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label right ">写作内容：</label>
                        <div class="col-sm-7">
                                            <textarea type="text" class="form-control"
                                                      placeholder="" id="writing_content"
                                                      disabled></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label right ">写作附件：</label>
                        <div class="col-sm-7">
                            <a href="../../static/img/a1.jpg" download="文件下载"><i
                                    class="fa fa-download"></i></a>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label right ">审批内容：</label>
                        <div class="col-sm-7">
                            <textarea type="text" class="form-control" id="audit_content"></textarea>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button class="btn btn-success" data-dismiss="modal">关闭</button>
                <button class="btn btn-success" id="modifyHomeWork">确定</button>
            </div>
        </div>
    </div>
</div>
<!--学生评价-->
<div class="modal fade" id="assessment" tabindex="-1">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <span class="close" data-dismiss="modal">&times;</span>
                <h3 class="modal-title">评价</h3>
            </div>
            <div class="modal-body" style="margin-top: 20px">
                <form action="#" class="form-horizontal" method="post">
                    <div class="form-group">
                        <label class="col-sm-3 control-label right ">学生姓名：</label>
                        <div class="col-sm-7">
                            <input type="hidden" id="evalutionStuId">
                            <input type="text" class="form-control stu_name" placeholder="" disabled
                                   id="evalutionStuName">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label right ">评价内容：</label>
                        <div class="col-sm-7">
                            <textarea type="text" class="form-control" id="evalutionBox"></textarea>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button class="btn btn-success" data-dismiss="modal">关闭</button>
                <button class="btn btn-success" id="evalutionContent">确定</button>
            </div>
        </div>
    </div>
</div>
<!--请假处理-->>
<div class="modal fade" id="leave" tabindex="-1">
    <input type="hidden" id="leaveId">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <span class="close" data-dismiss="modal">&times;</span>
                <h3 class="modal-title">提示</h3>
            </div>
            <div class="modal-body" style="margin-top: 20px">
                <form action="#" class="form-horizontal" method="post">
                    <div class="form-group">
                        <label class="col-sm-3 control-label right ">是否需要通过审批</label>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button class="btn btn-success" data-dismiss="modal">关闭</button>
                <button class="btn btn-success" id="allowApproval">确定</button>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="no_leave" tabindex="-1">
    <input type="hidden" id="refuseId">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <span class="close" data-dismiss="modal">&times;</span>
                <h3 class="modal-title">提示</h3>
            </div>
            <div class="modal-body" style="margin-top: 20px">
                <form action="#" class="form-horizontal" method="post">
                    <div class="form-group">
                        <label class="col-sm-3 control-label right ">是否需要拒绝审批</label>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button class="btn btn-success" data-dismiss="modal">关闭</button>
                <button class="btn btn-success" id="refuseApproval">确定</button>
            </div>
        </div>
    </div>
</div>
</body>
<!-- 全局js -->
<script src="../../static/js/jquery.min.js?v=2.1.4" th:src="@{/static/js/jquery.min.js}"></script>
<script src="../../static/js/bootstrap.min.js?v=3.3.6" th:src="@{/static/js/bootstrap.min.js}"></script>
<!-- 自定义js -->
<script src="../../static/js/content.js?v=1.0.0" th:src="@{/static/js/content.js}"></script>
<!-- Bootstrap table -->
<script src="../../static/js/plugins/bootstrap-table/bootstrap-table.min.js"
        th:src="@{/static/js/plugins/bootstrap-table/bootstrap-table.min.js}"></script>
<script src="../../static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"
        th:src="@{/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js}"></script>
<script src="../../static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"
        th:src="@{/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js}"></script>
<!--动态搜索-->
<script src="../../static/js/plugins/suggest/bootstrap-suggest.min.js"
        th:src="@{/static/js/plugins/suggest/bootstrap-suggest.min.js}"></script>
<!--图书封面效果-->
<script src="../../static/js/plugins/move/move.js" th:href="@{/static/js/plugins/move/move.js}"></script>
<!-- layerDate plugin javascript -->
<script src="../../static/js/plugins/layer/laydate/laydate.js"
        th:src="@{/static/js/plugins/layer/laydate/laydate.js}"></script>
<!-- Sweet alert -->
<script src="../../static/js/plugins/sweetalert/sweetalert.min.js"
        th:src="@{/static/js/plugins/sweetalert/sweetalert.min.js}"></script>
<!-- simditor -->
<script type="text/javascript" src="../../static/js/plugins/simditor/module.js"
        th:src="@{/static/js/plugins/simditor/module.js}"></script>
<script type="text/javascript" src="../../static/js/plugins/simditor/uploader.js"
        th:src="@{/static/js/plugins/simditor/uploader.js}"></script>
<script type="text/javascript" src="../../static/js/plugins/simditor/hotkeys.js"
        th:src="@{/static/js/plugins/simditor/hotkeys.js}"></script>
<script type="text/javascript" src="../../static/js/plugins/simditor/simditor.js"
        th:src="@{/static/js/plugins/simditor/simditor.js}"></script>
<!-- Prettyfile -->
<script src="../../static/js/plugins/prettyfile/bootstrap-prettyfile.js"
        th:src="@{/static/js/plugins/prettyfile/bootstrap-prettyfile.js}"></script>
<!--日期选择-->

<!--自定义js---表格操作-->
<!-- 主要用于表格的删除按钮功能实现 -->
<script src="../../static/public/exam/tableOperation.js"
        th:src="@{/static/public/exam/tableOperation.js}"></script>
<script>
    $(function () {
        $("#className").text("班级名称：[[${className}]]");
    })
    //日期范围限制
    var start = {
        elem: '#start',
        format: 'YYYY-MM-DD hh:mm:ss',
        min: laydate.now(), //设定最小日期为当前日期
        max: '2099-06-16 23:59:59', //最大日期
        istime: true,
        istoday: false,
        choose: function (datas) {
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas //将结束日的初始值设定为开始日
        }
    };
    var end = {
        elem: '#end',
        format: 'YYYY-MM-DD hh:mm:ss',
        min: laydate.now(),
        max: '2099-06-16 23:59:59',
        istime: true,
        istoday: false,
        choose: function (datas) {
            start.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };
    var bad_time = {
        elem: '#bad_time',
        format: 'YYYY-MM-DD hh:mm:ss',
        min: laydate.now(),
        max: '2099-06-16 23:59:59',
        istime: true,
        istoday: false,
        choose: function (datas) {
            start.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };
    laydate(start);
    laydate(end);
    laydate(bad_time);

    /*文件上传*/
    $('#file-pretty input[type="file"]').prettyFile();

    /*班级资源删除按钮*/
    $('.delete_list').click(function () {
        var selectList = $('#tb_departments_2').bootstrapTable('getAllSelections'); //获得选中
        if (selectList.length === 0 || selectList === "") {
            swal({
                title: "提示",
                text: "至少选择一行",
                type: "warning",
                closeOnConfirm: true, //关闭
            });
            return false;
        }
        let ids = [];
        for (let i = 0; i < selectList.length; i++) {
            //获取选中行的id
            ids.push(selectList[i].id);
        }
        swal({
            title: "提示",
            text: "你确定要删除这" + ids.length + "记录吗?请谨慎操作!",
            type: "warning",
            showCancelButton: true,
            cancelButtonText: '取消',
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "删除",
            closeOnConfirm: false, //关闭
        }, function () {
            //TODO AJAX请求
            $.ajax({
                url: "/owep/class/deleteClassResource",
                method: "post",
                async: true,
                data: JSON.stringify(ids),
                dataType: "text",   //期望服务端返回的数据类型
                contentType: "application/json",
                success: function (data) {
                    console.log(data.toString());
                    swal("删除成功！", "您已经永久删除已选信息", "success");
                    //重新加载页面
                    $("#tb_departments_2").bootstrapTable("refresh")
                },
                error: function (jqXHR) {
                    swal("删除失败！", "未知错误", "error");
                }
            });
        })
    })
    //====================班级资源的查询
    $(function () {
        $("#selectResource").click(function () {
            var resourceName = $("#exampleInputUserName2").val();
            var key = {
                "ResourceName": resourceName
            }
            $.ajax({
                url: "/owep/class/findResourceByName",
                method: "post",
                data: key,
                success: function (data) {
                    console.log(data);
                    $("#tb_departments_2").bootstrapTable("load", data);
                },
                error: function (jqXHR) {
                    alert("查询失败");
                }
            })
        })
    })

</script>
<script>
    $(function () {
        //1.初始化Table
        var oTable = new TableInit();
        oTable.Init();
        //2.初始化Button的点击事件
        var oButtonInit = new ButtonInit();
        oButtonInit.Init();
    });

    var TableInit = function () {
        testIllegal;
        var oTableInit = new Object();
        //初始化Table
        oTableInit.Init = function () {
            //===========================================班级资源==================================================
            $('#tb_departments_2').bootstrapTable({
                url: '/owep/class/allClassResource',       //请求后台的URL（*）
                method: 'post',                      //请求方式（*）
                striped: true,                      //是否显示行间隔色
                pagination: true,                   //是否显示分页（*）
                queryParams:
                oTableInit.queryParams,//传递参数（*）
                pageNumber: 1,                       //初始化加载第一页，默认第一页
                pageSize: 10,                       //每页的记录行数（*）
                pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
                uniqueId: "ID",                     //每一行的唯一标识，一般为主键列
                columns:
                    [{
                        checkbox: true
                    }, {
                        field: 'id',
                        title: 'id',
                        visible: false //隐藏
                    }, {
                        field: 'resourceName',
                        title: '资源名称'
                    }, {
                        field: 'type',
                        title: '资源类型',
                        formatter: resourceType
                    }, {
                        field: 'resourceSize',
                        title: '资源大小(kb)'
                    }, {
                        field: 'operate',
                        title: '操作',
                        width: 100,
                        events: {
                            'click button[title=删除]': function (e, value, row, index) {//动态嵌入按键：删除
                                deleteRecord(e, value, row, index, "/owep/class/deleteClassResourceId", '#tb_departments_2');
                            }
                        },
                        formatter: function (value, row, index) {
                            return ['<button id = "" type = "button" class = "btn btn-white" title="无此权限" data-toggle="tooltip" data-placement="top" disabled > <i class="fa fa-cloud-download"/> </button>' +
                            '<button id = "" type = "button" class = "btn  btn-white" data-toggle="tooltip" data-placement="top" title="删除" > <i class="glyphicon glyphicon-trash text-danger"/> </button>'].join("");//删除
                        }
                    }]
            });
        };

        function resourceType(value) {
            if (value == 1) {
                return "课程资源"
            } else {
                return "公共资源"
            }
        }

        //======================================班级问题===========================================================
        $('#tb_departments_3').bootstrapTable({
            url: '/owep/class/classQuestion',       //请求后台的URL（*）
            method: 'post',                      //请求方式（*）
            striped: true,                      //是否显示行间隔色
            pagination: true,                   //是否显示分页（*）
            queryParams: oTableInit.queryParams,//传递参数（*）
            pageNumber: 1,                       //初始化加载第一页，默认第一页
            pageSize: 10,                       //每页的记录行数（*）
            pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
            /*      height:
                      500,   */                     //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
            uniqueId: "ID",                     //每一行的唯一标识，一般为主键列
            columns:
                [{
                    field: 'id',
                    title: '序号'
                }, {
                    field: 'questionContent',
                    title: '问题描述'
                }, {
                    field: 'courseName',
                    title: '相关课程'
                }, {
                    field: 'createTime',
                    title: '提问时间'
                }, {
                    field: 'stuName',
                    title: '提问人',
                }, {
                    field: 'responder',
                    title: '回答者',
                    visible: false
                }, {
                    field: 'answer_content',
                    title: '回答内容',
                    visible: false
                }, {
                    field: 'answer_time',
                    title: '回答时间',
                    visible: false
                }, {
                    field: 'operate',
                    title: '操作',
                    width: 150,
                    events: {
                        'click button[title=删除]': function (e, value, row, index) {//动态嵌入按键：删除
                            deleteRecord(e, value, row, index, "/owep/class/deleteClassRequestionId", '#tb_departments_3');
                        },
                        /*回显数据*/
                        // 'click button[title=详情]':function (e, value, row, index) {
                        //     $("#question_id").val(row.id);
                        //     $.ajax({
                        //         //发送AJAX请求
                        //         url: "/owep/class/selectQuestionReplyByQuestionId?questionId=" + row.id,
                        //         method: "GET",
                        //         async: true,
                        //         dataType: "json",
                        //         success: function (data) {
                        //             var dataObj = data;
                        //             var question = "";
                        //             var reply = "";
                        //             for (var key in dataObj){
                        //                 question = "<div class=\"ibox-content\">\n" +
                        //                     "                        <div class=\"team-members\">\n" +
                        //                     "                            <a href=\"#\"><img alt=\"member\" class=\"img-circle\" src=\"http://192.168.124.88:8886/"+JSON.parse(key).student.imageUrl+"\"></a>\n" +
                        //                     "                            <span class=\"lead\">"+JSON.parse(key).stuName+"</span>\n" +
                        //                     "                            <span class=\"label pull-right\">"+JSON.parse(key).createTime+"</span>\n" +
                        //                     "                        </div>\n" +
                        //                     "\n" +
                        //                     "                        <p>\n" +
                        //                     JSON.parse(key).questionContent +
                        //                     "                        </p>\n" +
                        //                     "                    </div>";
                        //                 $.each(dataObj[key],function (index,item) {
                        //                     reply += "<div class=\"ibox-content\">\n" +
                        //                         "                        <div class=\"team-members\">\n" +
                        //                         "                            <a href=\"#\"><img alt=\"member\" class=\"img-circle\" src=\"\"></a>\n" +
                        //                         "                            <span class=\"lead\">"+item.replyAuthor+"</span>\n" +
                        //                         "                            <span class=\"label pull-right\">"+item.createTime+"</span>\n" +
                        //                         "                        </div>\n" +
                        //                         "                        <p>\n" +
                        //                         item.replyContent +
                        //                         "                        </p>\n" +
                        //                         "                    </div>";
                        //                 });
                        //             }
                        //
                        //             $("#question_box").html(question);
                        //             $("#reply_box").html(reply);
                        //         },
                        //         error: function (jqXHR) {
                        //             alert("删除失败");
                        //         }
                        //
                        //     });
                        // }
                        "click #message": function (e, value, row, index) {
                            $('#qa').modal();
                            $("strong.student").text(row.stuName + "[学生]");
                            $("strong.admin").text(row.questionContent + "[老师]");
                            $("p:first").text(row.problem);
                            $("p").eq(1).text(row.answer_content);
                            $("small.text-muted").eq(0).text(row.question_time);
                            $("small.text-muted").eq(1).text(row.answer_time);
                        },
                    },
                    formatter: function (value, row, index) {
                        return ['<button id = "message" btn_click="1" type = "button" class = "btn btn-white" title="详情" data-toggle="tooltip" data-placement="top"  > <i class="fa fa-road"/> </button>' +
                        '<button id = "" type = "button" class = "btn  btn-white" data-toggle="tooltip" data-placement="top" title="删除" > <i class="glyphicon glyphicon-trash text-danger"/> </button>'];//删除
                    },
                }]
        });

        //====================================批改作业==========================================================
        $('#tb_departments_4').bootstrapTable({
            url: '/owep/class/homeWork?classId=[[${classId}]]',       //请求后台的URL（*）
            method: 'post',                      //请求方式（*）
            striped: true,                      //是否显示行间隔色
            pagination: true,                   //是否显示分页（*）
            queryParams: oTableInit.queryParams,//传递参数（*）
            pageNumber: 1,                       //初始化加载第一页，默认第一页
            pageSize: 10,                       //每页的记录行数（*）
            pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
            uniqueId: "ID",                     //每一行的唯一标识，一般为主键列
            columns: [{
                field: "id",
                title: "id",
                visible: false //隐藏
            }, {
                field: 'workTitle',
                title: '作业标题'
            }, {
                field: 'workContent',
                title: '作业内容'
            }, {
                field: 'startTime',
                title: '布置时间',
                visible: false //隐藏
            }, {
                field: 'answerContent',
                title: '学生答案'
            }, {
                field: 'studentName',
                title: '学生姓名'
            }, {
                field: 'createTime',
                title: '写作时间'
            }, {
                field: 'operate',
                title: '操作',
                width: 150,
                events: {
                    "click #check_work": function (e, value, row, index) {
                        $('#checkwork').modal();
                        /*回显数据*/
                        $('#work_title').val(row.workTitle);
                        $('#work_content').val(row.workContent);
                        $('#start_time').val(row.startTime);
                        $('#stu_name').val(row.studentName);
                        $('#work_time').val(row.createTime);
                        $('#writing_content').val(row.answerContent);
                        $('#audit_content').val(row.auditContent);
                        $('#approvalId').val(row.id);
                    },
                },
                formatter: function (value, row, index) {
                    return '<button id = "check_work" type = "button" class = "btn btn-white" title="详情" data-toggle="tooltip" data-placement="top"  > <i class="fa fa-edit"/> </button>';
                }
            }]
        });

        //===========================================学生评价表中数据=======================================================================
        $('#tb_departments_5').bootstrapTable({
            url: '/owep/class/allEvaluate',       //请求后台的URL（*）
            method: 'post',                      //请求方式（*）
            striped: true,                      //是否显示行间隔色
            pagination: true,                   //是否显示分页（*）
            queryParams: oTableInit.queryParams,//传递参数（*）
            pageNumber: 1,                       //初始化加载第一页，默认第一页
            pageSize: 10,                       //每页的记录行数（*）
            pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
            uniqueId: "ID",                     //每一行的唯一标识，一般为主键列
            columns: [{
                checkbox: true
            }, {
                field: "id",
                title: "id",
                visible: false //隐藏
            }, {
                field: 'stuNumber',
                title: '学号'
            }, {
                field: 'stuName',
                title: '姓名'
            }, {
                field: 'gender',
                title: '性别',
                formatter: changeType
            }, {
                field: 'stuPhone',
                title: '手机'
            }, {
                field: 'stuEmail',
                title: '邮箱'
            }, {
                field: 'effectiveDate',
                title: '有效日期'
            }, {
                field: 'status',
                title: '状态',
                formatter: showStatus
            }, {
                field: 'evaluate',
                title: '评价',
                width: 150,
                events: {
                    "click #evaluation": function (e, value, row, index) {
                        $('#assessment').modal();
                        /*回显数据*/
                        $('#evalutionStuId').val(row.id);
                        $('#evalutionStuName').val(row.stuName);
                    }
                },
                formatter: function (value, row, index) {
                    return '<button id = "evaluation" type = "button" class = "btn btn-white" title="详情" data-toggle="tooltip" data-placement="top" > <i class="fa fa-edit"/> </button>';
                }
            }]

        });

        function changeType(value) {
            if (value == 1) {
                return '男';
            }
            if (value == 0) {
                return '女';
            }
        }

        function showStatus(value) {
            if (value == 1) {
                return '启用';
            }
            if (value == 0) {
                return '未启用';
            }
        }

        $('#evalutionContent').click(function () {
            let stuId = $('#evalutionStuId').val();
            let evalution = $('#evalutionBox').val();
            let changeEvalution = {
                "stuId": stuId,
                "evalution": evalution
            };
            let changeEvalutionJSON = JSON.stringify(changeEvalution);
            console.log(changeEvalutionJSON);
            $.ajax({
                type: "POST",
                url: "/owep/class/updateEvalution",
                data: changeEvalutionJSON,
                contentType: "application/json",
                dataType: "text",
                success: function (data) {
                    // alert(data);
                    // window.location.reload();
                    $('#tb_departments_5').bootstrapTable("refresh");
                    $("#assessment").modal("hide");
                },
                error: function (jqXHQ) {
                    alert("修改失败");
                }
            });
        })

        $('#modifyHomeWork').click(function () {
            let id=$('#approvalId').val();
            let approvalContent=$('#audit_content').val();
            let changeApproval={
                "id":id,
                "approvalContent":approvalContent
            }
            //let changeEvalutionJSON = JSON.stringify(changeApproval);
            $.ajax({
                type: "POST",
                url: "/owep/class/updateApprovalContent",
                data: changeApproval,
               //contentType: "application/json",
                //dataType: "text",
                success: function (data) {;
                    $('#tb_departments_4').bootstrapTable("refresh");
                    $('#checkwork').modal("hide");
                },
                error: function (jqXHQ) {
                    alert("修改失败");
                }
            });
        })
        //==================================请假处理===================================
        $('#tb_departments_6').bootstrapTable({
            url: '/owep/class/leave',       //请求后台的URL（*）
            method: 'post',                      //请求方式（*）
            striped: true,                      //是否显示行间隔色
            pagination: true,                   //是否显示分页（*）
            queryParams: oTableInit.queryParams,//传递参数（*）
            pageNumber: 1,                       //初始化加载第一页，默认第一页
            pageSize: 10,                       //每页的记录行数（*）
            pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
            uniqueId: "ID",                     //每一行的唯一标识，一般为主键列
            columns: [{
                field: 'id',
                title: '序号'
            }, {
                field: 'leaveTime',
                title: '请假时间'
            }, {
                field: 'leaveTime',
                title: '结束时间'
            }, {
                field: 'studentName',
                title: '学生姓名'
            }, {
                field: 'reasonLeave',
                title: '请假事由'
            }, {
                field: 'approvalStatus',
                title: '审批状态',
                formatter: approval
            }, {
                field: 'operate',
                title: '操作',
                width: 150,
                formatter: function (value, row, index) {
                    return ['<button id = "leaveBtn" type = "button" class = " btn btn-white" title="通过审查"  data-toggle="modal"  data-toggle="tooltip" > <i class="glyphicon glyphicon-ok"/> </button>' +
                    '<button id = "leaveBtn_1" type = "button" class = "btn  btn-white" data-toggle="modal" data-toggle="tooltip"  title="拒绝审查" > <i class="glyphicon glyphicon-remove text-danger"/> </button>'];//删除
                },
                events: {
                    "click #leaveBtn": function (e, value, row, index) {
                        $('#leave').modal();
                        /*回显数据*/
                        $('#leaveId').val(row.id);
                    },
                    "click #leaveBtn_1": function (e, value, row, index) {
                        $('#no_leave').modal();
                        /*回显数据*/
                        $('#refuseId').val(row.id);
                    }

                }
            }]

        });

        function approval(value) {
            if (value == 1) {
                return "待审核";
            }
            if (value == 2) {
                return "审核通过"
            }
            if (value == 0) {
                return "未通过"
            } else {
                return "状态错误"
            }
        }

        $('#allowApproval').click(function () {
            let leaveId = $('#leaveId').val();
            console.log(leaveId);
            $.ajax({
                type: "POST",
                url: "/owep/class/allowApprovalStatus?id=" + leaveId,
                contentType: "application/json",
                success: function (data) {
                    $('#tb_departments_6').bootstrapTable("refresh");
                    $("#leave").modal('hide');
                },
                error: function (jqXHQ) {
                    alert("修改失败");
                }
            });
        })

        $('#refuseApproval').click(function () {
            let refuseId = $('#refuseId').val();
            $.ajax({
                type: "POST",
                url: "/owep/class/refushApprovalStatus?id=" + refuseId,
                contentType: "application/json",
                success: function (data) {
                    $('#tb_departments_6').bootstrapTable("refresh");
                    $("#no_leave").modal('hide');
                },
                error: function (jqXHQ) {
                    alert("修改失败");
                }
            });
        })

        //============================================违纪问题==================================================
        $('#tb_departments_7').bootstrapTable({
            url: '/owep/class/Illegal',       //请求后台的URL（*）
            method: 'post',                      //请求方式（*）
            striped: true,                      //是否显示行间隔色
            pagination: true,                   //是否显示分页（*）
            queryParams: oTableInit.queryParams,//传递参数（*）
            pageNumber: 1,                       //初始化加载第一页，默认第一页
            pageSize: 10,                       //每页的记录行数（*）
            pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
            uniqueId: "ID",                     //每一行的唯一标识，一般为主键列
            columns: [{
                    field: 'stuNumber',
                    title: '学号'
                }, {
                    field: 'studentName',
                    title: '姓名'
                }, {
                    field: 'disciplineTime',
                    title: '违纪时间'
                }, {
                    field: 'presentationCondition',
                    title: '情况说明'
                }, {
                    field: 'operate',
                    title: '操作',
                    width: 150,
                    events: {
                        'click button[title=删除]': function (e, value, row, index) {//动态嵌入按键：删除
                            deleteRecord(e, value, row, index, "/owep/class/deleteClassRequestionId", '#tb_departments_7');
                        }
                    },
                    formatter: function (value, row, index) {
                        return ['<button id = "" type = "button" class = "btn btn-white" title="无此权限" data-toggle="tooltip" data-placement="top" disabled > <i class="fa fa-cloud-download"/> </button>' +
                        '<button id = "leave_btn" type = "button" class = "btn  btn-white" data-toggle="tooltip" data-placement="top" title="删除" > <i class="glyphicon glyphicon-trash text-danger"/> </button>'];//删除
                    }
                }],
        });

        //违纪的查询按钮
        $("#selectIllegal").click(function () {
            let stuNumber = "%"+$("#class_num").val()+"%";
            let studentName = "%"+$("#major_name").val()+"%";
            let creatTime = $("#start").val();
            let endTime = $("#end").val();
            let key = {
                "stuNumber": stuNumber,
                "studentName":studentName,
                "creatTime":creatTime,
                "endTime":endTime
            }
            $.ajax({
                url: "/owep/class/findIllegalByField",
                method: "post",
                data: key,

                success: function (data) {
                    $("#tb_departments_7").bootstrapTable("load", data);
                },
                error: function (jqXHR) {
                    alert("查询失败");
                }
            })
        })

        /*添加违纪按钮*/
        $('#add_sure').click(function () {
            var form = document.forms["addIllegalForm"];
            var formData = new FormData(form);
            //获取add_form_model表单并提交
            // let illegalStudent=$("#IllegalId").val();
            // let illegalTime=$("#bad_time").val();
            // let pollContent = $("#illustrate").val();
            // var illegal = {
            //     "studentName": illegalStudent,
            //     "disciplineTime": illegalTime,
            //     "presentationCondition":pollContent
            // };
            //var illegalJSON = JSON.stringify(illegal);
            $.ajax({
                type: "POST",
                url: "/owep/class/addIllegal",
                data: formData,
                dataType: "text",
                processData: false,
                contentType: false,
                success: function (data) {
                    $("#tb_departments_7").bootstrapTable("refresh");
                    $("#add").modal("hide");
                },
                error: function (jqXHQ) {
                    alert("添加失败");
                }
            });
        });


        //鼠标悬停提示
        $(function () {
            $('[data-toggle="tooltip"]').tooltip()
        });
        $(function () {
            $('#message').tooltip()
        });

        //得到查询的参数
        oTableInit.queryParams = function (params) {
            var temp = {   //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
                limit: params.limit,   //页面大小
                offset: params.offset,  //页码
                departmentname: $("#txt_search_departmentname").val(),
                statu: $("#txt_search_statu").val()
            };
            return temp;
        };
        return oTableInit;
    };
    var ButtonInit = function () {
        var oInit = new Object();
        var postdata = {};
        oInit.Init = function () {
        };

        return oInit;
    };

    //自动补齐违规学生
    var classId="[[${classId}]]";
    var testIllegal=$("#IllegalId").bsSuggest({
        indexId: 0, //data.value 的第几个数据，作为input输入框的内容
        indexKey: 0, //data.value 的第几个数据，作为input输入框的内容
        //TODO 通过json显示数据
        url:"/owep/class/findIllegalStudent?classId="+classId,
        showBtn: true,
        idField: "id",
        keyField: "stuName",
        effectiveFields: ["stuName"],
        searchFields:["stuName"]
    }).on("onSetSelectValue",function (e, keyword) {
        $("#studentId").val(keyword.id);
    });

    $(function () {
        $("#back").click(function () {
            $.ajax({
                url: "/owep/teaching/backTeaching"
            })
        })
    })

</script>
<!--班级问题富文本框-->
<script>
    var editor = new Simditor({
        textarea: $('#editor')
    });
    /*清除样式*/
    $(".simditor-toolbar").removeAttr("style"); //ie,ff均支持
</script>
</html>